///////////////////////////////////////////////////////////////////////////////
/// @file library_generic.cpp
/// @author Benjamin J. Orr
/// @brief Templated functions that I wish already existed
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
/// @fn unsigned int search(vector<Generic> & v, Generic x)
/// @brief No frills. Searches through v for x
/// @pre v is not empty
/// @param vector<Generic> & v -- The vector we're rooting through
/// @param Generic x -- What we're searching for
/// @return Position of x or UINT_MAX
///////////////////////////////////////////////////////////////////////////////
template <class Generic>
unsigned int search(const vector<Generic> & v, const Generic x)
{
  //Default to UNINT_MAX, we'll overwrite this later if we can
  int pos = UINT_MAX;
  
  for(int i = 0; i < v.size(); i++)
  {
    if(v[i] == x)
    {
      pos = i;
    }
  }
  return pos;
}
